{extend name="template/base" /}
{block name="content"}
<div class="page-container">
<form class="mb-20" id='form' method="get" action="{:\\think\\Url::build($Request.action)}">

    <div class="cl pd-5 bg-1 bk-gray">
	<!--<button class="btn btn-primary" type="submit" onclick="javascript: document.getElementById('sta').value=0;return(aChoice())">继承选中题库</button>-->
		<button class="btn btn-primary" type="button" id='fenxiang' >继承选中题库</button>
	
        <span class="r pt-5 pr-5">
            共有 <strong>{$count ?? '0'}</strong> 个题库
        </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            <th class="table-id"><input type="checkbox">&nbsp;全选</th>
			<th style="width:20%;">题库名</th>
			<th class="table-status" style="width: 50px;">题库层级</th>
			<th class="table-status" style="width: 55px;">试题数量</th>


			<th class="table-status" style="width: 55px;">题库封面</th>
			<!-- <th style="width:13%;">知识点</th> -->
			<th class="table-status" style="width: 40px;" >状态</th>

			<th class="table-status" style="width:15%;">试题管理</th>
			<th style="width: 24%">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            <td class="table-id"><input type="checkbox" name="id[]" value="{$vo.id}">&nbsp;{$vo.id}</td>
			<td style="width:20%;" class="overflow-hidden">{$vo.name|high_light=$Request.param.name}</td>
			<td class="table-status">{if condition="$vo.parentid eq 0"}<font color='red'>顶级题库</font>{else}分题库{/if}</td>
			<td class="table-status">共{$vo.total}题</td>


			<td class="table-status"><img src='{$vo.thumb}' width='40' height='40' ></td>
			<!--<td style="width:13%;word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"></td> -->
			<td class="table-status">{$vo.status|get_status}</td>

			<td class="table-status" style="width:15%;">
				1
				
			</td>
			<td class="f-14">
			 <a href="javascript:;" onclick="resume_all('{$vo.id}','{$vo.name}')" class="btn btn-success radius mr-5"> 继承题库</a>
			</td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page-bootstrap">{$page ?? ''}</div>
</div>
</form>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script>

function resume_all(id,pro){
		layer.confirm('是否要继承题库：'+pro+'？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			$.post("{:\\think\\Url::build($Request.action)}",{cid:id},function(result){
				layer.msg(result.msg);
			});
		}, function(){
		  
		});
}

$("#fenxiang").click(function(){
		layer.confirm('是否要继承题库？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
				 //layer.closeAll();
						  
				
			$.ajax({
				cache: true,
				type: "POST",
				url:  '{:\\think\\Url::build($Request.action)}',
				data: $('#form').serialize(),// 你的formid
				async: false,
				error: function(request) {
					layer.msg('继承失败请检查网络并重试');
				},
				success: function(data) {
				layer.msg('继承成功');
				  
				setTimeout(function(){ location.reload(); },1000);		
				
					
				}
			});

			  
		}, function(){

		});
});

    $(function () {
       

        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: false,
            callback: function (ret){
                ajax_progress(ret);
            }
        });
    })
</script>

{/block}

